﻿# -*- coding: utf-8 -*-
'''
Created on 2010-7-3
@author: me
#filename: collection_list

list 可以做为队列，堆栈使用
print语句的结尾使用了一个 逗号 来消除每个print语句自动打印的换行符。
'''
class ListTest:
    shoplist = ['apple','mango','carrot','banana']
    
    def lenTest(self):
        print 'I have', len(ListTest.shoplist), ' items to purchase.'
        
    def listTest(self):
        print 'These items are:',   #Notice the comma at end of the line
        for item in ListTest.shoplist :
            print item,
    def 
print '\nI also have to buy rice.'
shoplist.append('rice')
print 'My shopping list is now', shoplist

print 'I will sort my list now'
shoplist.sort()
print 'Sorted shopping list is', shoplist

print 'The first item I will buy is', shoplist[0]
olditem = shoplist[0]
del shoplist[0]
print 'I bought the ',olditem
print 'My shopping list is now', shoplist

#对于链表，有三个很有用的内置函数有用： map ,filter ,reduce

def foo():
    return 3, 5.5
alpha, beta = foo()



